<template>
  <view>
    <view class="photo">
      <image mode="widthFix" :src="brand_logo"></image>
    </view>
    <!-- 新api用 -->
    <!-- <button class="login_btn" v-if="!isAndroid" @click="getUserProfile">
      微信用户登录
    </button> -->
    <!-- <button
      class="login_btn"
      open-type="getUserInfo"
      @getuserinfo="getUserInfo"
    >
      微信用户登录
    </button> -->
    <!-- {{ isAndroid }} -->
    <view class="btn_box">
      <button class="photo_login_btn login-btn__color" :class="{ isAndroid: isAndroid }" open-type="getPhoneNumber"
        @getphonenumber="decryptPhoneNumber">
        手機號壹鍵登錄
      </button>
      <button class="photo_login_btn login_btn2 login-btn__color" :class="{ isAndroid: isAndroid }"
        v-if="!checkedVal || !canLogin" @click.stop="isReadRuls">
        手機號壹鍵登錄
      </button>
      <button class="photo_login_btn not-login-btn__color " @click="notLogin">
        暫不登錄
      </button>
    </view>
    <view class="radio_box">
      <u-checkbox-group>
        <u-checkbox activeColor="#de4141" @change="change"></u-checkbox>
      </u-checkbox-group>
      <view>
        我已閱讀、理解並同意此<text class="policy" @click="openPrivacyHK">《個人聲明》</text>。</view>
    </view>
    <!-- <RulesCompany ref="rule"></RulesCompany> -->
    <PrivacyPolicyHK ref="privacyHK"></PrivacyPolicyHK>
  </view>
</template>

<script>
import { logo4Img } from '@/static/js/staticData'
import { mapState, mapMutations } from 'vuex'
import { UserLogin } from '@/mixins/UserLogin'
import { groupIntroductionApi } from '@/API/carSeries'
export default {
  mixins: [UserLogin], // 混入
  name: 'UserLogin',
  created() {
    this.getCode()
  },
  computed: {
    ...mapState(['isAndroid']),
    brand_logo() {
      // return `https://www.kamlung.net/images/qrlogo/wx-${brand}.png`
      return logo4Img
    }
  },
  onLoad(e) {
    console.log('object :>> ',);
    this.groupIntroductionFn()
  },
  methods: {
    async groupIntroductionFn() {
      console.log('object :>> ',);
      const {
        data: { result, code }
      } = await groupIntroductionApi()
      if (code == 200) {
        let { copy_privacy_policy_zh = '' } = result[0]
        console.log('result :>> ', copy_privacy_policy_zh);
      }
    },
    ...mapMutations(['saveLoginInfo']),

  },
}
</script>

<style lang="scss">
.photo {
  width: 190rpx;
  height: 190rpx;
  border-radius: 50%;
  border: 2rpx solid rgba(0, 0, 0, 0.05);
  background-color: #fff;
  margin: 220rpx auto 100rpx auto;
  display: flex;
  justify-content: center;
  align-items: center;

  image {
    width: 160rpx;
    height: 160rpx;
  }
}

.login_btn {
  // margin-top: 60rpx;
  margin-bottom: 60rpx;
  border-radius: 200rpx;
  width: 80%;
  font-size: 34rpx;
  background: #dd444c;
  color: #fff;
}



.isAndroid {
  color: #fff;
  background: #dd444c !important;
}

.btn_box {
  position: relative;

  .login_btn2 {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
  }

  .photo_login_btn {
    margin-bottom: 60rpx;
    border-radius: 200rpx;
    width: 80%;
    font-size: 34rpx;
    // background: #fff;


    // color: #000;
    &::after {
      border: 2rpx solid rgba(0, 0, 0, 0.2);
      border-radius: 200rpx;
    }
  }

  .login-btn__color {
    background: #dd444c;
    color: #fff;
  }

  .not-login-btn__color {
    background: #fff;
    // border: 1px solid #666;
    // color: #666;
    border: 1px solid #dd444c;
    color: #dd444c;
  }
}

.radio_box {
  display: flex;
  justify-content: center;
}

.policy {
  color: #dd444c;
}
</style>
